<script setup lang="ts">
import { computed } from 'vue'

// 个人项目列表 - 您可以根据需要修改这些项目信息
// 每个项目包含以下字段:
// - name: 项目名称
// - description: 项目描述
// - link: 项目链接（GitHub或其他网址）
// - icon: 项目图标（推荐使用emoji）
// - tags: 项目标签数组
const projects = [
  {
    name: '零壹博客',
    description: 'Java后端技术博客，分享学习笔记与开发经验',
    link: 'https://github.com/your-username/lingyi-notes',
    icon: '📚',
    tags: ['VitePress', 'Java', 'Blog']
  },
  {
    name: '产业学院官网',
    description: '红河学院人工智能产业学院官网',
    link: 'https://xf-studio.cn/',
    icon: '🏫',
    tags: ['Vue', '官网']
  },
  {
    name: '社团管理平台',
    description: '红河学院讯飞工作室社团管理平台，支持社团信息和活动管理',
    link: 'https://github.com/your-username/your-project',
    icon: '👥',
    tags: ['Vue', 'SpringBoot', 'MySQL', 'EasyExcel']
  },
  {
    name: '校园导览',
    description: '红河学院校园导览系统，提供校园地图和位置导航服务',
    link: 'https://github.com/your-username/your-project',
    icon: '🗺️',
    tags: ['Vue', 'Node.js', '地图']
  },
  {
    name: 'AI零代码生成平台',
    description: 'AI智能体开发平台，支持AI工作流低代码配置和智能体生成',
    link: 'https://github.com/your-username/your-project',
    icon: '🤖',
    tags: ['Vue', 'Spring Alibaba', 'LangChain4j', 'AI']
  },
  {
    name: 'xf-studio工作室',
    description: '讯飞工作室官方网站，展示工作室项目和团队信息',
    link: 'https://xf-studio.cn/',
    icon: '🎨',
    tags: ['Vue', '工作室', '官网']
  }
]
</script>

<template>
  <div class="m-projects">
    <h2 class="m-projects-title">个人作品</h2>
    <p class="m-projects-subtitle">展示一些有趣的项目和实践</p>

    <div class="m-projects-grid">
      <a
        v-for="(project, index) in projects"
        :key="index"
        :href="project.link"
        target="_blank"
        rel="noopener noreferrer"
        class="m-project-card"
      >
        <div class="m-project-icon">{{ project.icon }}</div>
        <div class="m-project-content">
          <h3 class="m-project-name">{{ project.name }}</h3>
          <p class="m-project-description">{{ project.description }}</p>
          <div class="m-project-tags">
            <span v-for="tag in project.tags" :key="tag" class="m-project-tag">
              {{ tag }}
            </span>
          </div>
        </div>
        <div class="m-project-arrow">→</div>
      </a>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.m-projects {
  margin: 60px 0;
  padding: 40px 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.m-projects-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
  text-align: center;
  background: linear-gradient(120deg, var(--vp-c-brand), var(--vp-c-brand-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.m-projects-subtitle {
  text-align: center;
  color: var(--vp-c-text-2);
  margin: 0 0 30px 0;
  font-size: 14px;
}

.m-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 30px;
}

.m-project-card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--vp-c-divider);
  border-radius: 12px;
  background: var(--vp-c-bg-soft);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--vp-c-brand), var(--vp-c-brand-2));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  &:hover {
    border-color: var(--vp-c-brand);
    background: var(--vp-c-bg-mute);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);

    &::before {
      transform: translateX(0);
    }

    .m-project-arrow {
      transform: translateX(4px);
      color: var(--vp-c-brand);
    }
  }
}

.m-project-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.m-project-content {
  flex: 1;
}

.m-project-name {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--vp-c-text-1);
}

.m-project-description {
  font-size: 14px;
  color: var(--vp-c-text-2);
  margin: 0 0 12px 0;
  line-height: 1.5;
  min-height: 40px;
}

.m-project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.m-project-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--vp-c-brand-soft);
  color: var(--vp-c-brand);
  font-weight: 500;
  transition: all 0.3s ease;

  .m-project-card:hover & {
    background: var(--vp-c-brand);
    color: white;
  }
}

.m-project-arrow {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--vp-c-text-2);
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .m-projects {
    margin: 40px 0;
    padding: 30px 16px;
  }

  .m-projects-title {
    font-size: 24px;
  }

  .m-projects-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .m-project-card {
    padding: 20px;
  }

  .m-project-icon {
    font-size: 28px;
  }

  .m-project-name {
    font-size: 16px;
  }
}
</style>
